package com.ds.lens.data.service.dao.sql.provider;

import com.ds.lens.data.service.dao.entity.LensMonitorNotify;
import org.apache.ibatis.jdbc.SQL;

public class LensMonitorNotifySqlProvider {

    public String insertSelective(LensMonitorNotify record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("lens_monitor_notify");

        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }

        if (record.getTitle() != null) {
            sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
        }

        if (record.getRenotifyTime() != null) {
            sql.VALUES("renotify_time", "#{renotifyTime,jdbcType=INTEGER}");
        }

        if (record.getChannel() != null) {
            sql.VALUES("channel", "#{channel,jdbcType=INTEGER}");
        }

        if (record.getChannelContent() != null) {
            sql.VALUES("channel_content", "#{channelContent,jdbcType=VARCHAR}");
        }

        if (record.getMonitorId() != null) {
            sql.VALUES("monitor_id", "#{monitorId,jdbcType=BIGINT}");
        }

        if (record.getContent() != null) {
            sql.VALUES("content", "#{content,jdbcType=LONGVARCHAR}");
        }

        return sql.toString();
    }

    public String updateByPrimaryKeySelective(LensMonitorNotify record) {
        SQL sql = new SQL();
        sql.UPDATE("lens_monitor_notify");

        if (record.getTitle() != null) {
            sql.SET("title = #{title,jdbcType=VARCHAR}");
        }

        if (record.getRenotifyTime() != null) {
            sql.SET("renotify_time = #{renotifyTime,jdbcType=INTEGER}");
        }

        if (record.getChannel() != null) {
            sql.SET("channel = #{channel,jdbcType=INTEGER}");
        }

        if (record.getChannelContent() != null) {
            sql.SET("channel_content = #{channelContent,jdbcType=VARCHAR}");
        }

        if (record.getMonitorId() != null) {
            sql.SET("monitor_id = #{monitorId,jdbcType=BIGINT}");
        }

        if (record.getContent() != null) {
            sql.SET("content = #{content,jdbcType=LONGVARCHAR}");
        }

        sql.WHERE("id = #{id,jdbcType=BIGINT}");

        return sql.toString();
    }
}
